<template>
    <div>
        <div v-html="content"></div>
        <div v-for="(item,index) in fileList" :key="index"><a @click="downloadExl(item.filepath)">{{item.filename}}</a></div>
    </div>
</template>

<script>
import { 
    HttpGetAnnouncement,
} from '../../../service/homepage'
export default {
    props:['itemId'],
    data(){
        return {
            content:'',
            fileList:[],
        }
    },
    created(){
        // console.log(this.itemId)
        this.update()
    },
    methods:{
        downloadExl(fileurl){
            this.handleWebfs(process.env.VUE_APP_OLDBOSS + fileurl,{},'download')
        },
        update(){
            HttpGetAnnouncement({
                "search[EQ_id]":this.itemId
            }).then(res=>{
                // console.log(res)
                this.content = res.data.content[0].content;
                this.fileList =  JSON.parse(res.data.content[0].attachs)
            },err=>{
                this.$Message.error(err.message)
            })
        }
    }
}
</script>